<template>
	<page-meta :page-style="'overflow:'+(showSheetView?'hidden':'visible')"></page-meta>
	<view class="content">
		<view class="head">
			<view class="info">
				<text class="text1">2024年02月28日 星期二</text>
				<view class="wrap">
					<text class="text2">14:35 - 14:40</text>
					<view class="note">
						1课时
					</view>
				</view>
			</view>
			<liu-show-hide showText="展开" hideText="收起" @chang="onshowChange">
				<view class="row" v-for="(row, index) in visibleRows" :key="index">
					<view class="text">{{ row.text }}</view>
					<view class="value">{{ row.value }}</view>
				</view>
			</liu-show-hide>
		</view>
		<view class="tab">
			<view class="tab-item" @click="toDetail">
				<image class="image" src="@/static/切图 3 (1).png"></image>
				<view class="info">
					<text class="name">学员评价</text>
					<text class="note">1人未评价</text>
				</view>
			</view>
			<view class="tab-item" @click="toDetail">
				<image class="image" src="@/static/切图 3 (2).png"></image>
				<view class="info">
					<text class="name">作业评价</text>
					<text class="note">1去布置</text>
				</view>
			</view>
		</view>
		<view class="filter-wrap">
			<view class="left">
				<view class="item">
					<text class="text">到课</text>
					<text class="text value">0</text>
				</view>
				<view class="item">
					<text class="text">迟到</text>
					<text class="text value">0</text>
				</view>
				<view class="item">
					<text class="text">请假</text>
					<text class="text value">0</text>
				</view>
				<view class="item">
					<text class="text">未到</text>
					<text class="text value">0</text>
				</view>
			</view>
			<view class="right" @click="toFilter">
				<image src="@/static/ico_s1.png" mode="aspectFill"></image>
				<text class="text">筛选</text>
			</view>
		</view>
		<view class="list">
			<view class="list-item" v-for="(item,index) in userList" :key="index">
				<image mode="aspectFill" class="avatar"></image>

				<view class="info">
					<text class="name">{{item.name}}</text>
					<text class="note">{{item.note}}</text>
				</view>

				<view class="fixed-right-text">
					<text class="status-text"
						:style="{color:item.status==1?'#00B578':(item.status==2?'#FA5151':'#FF8535')}">{{item.text}}</text>
				</view>
			</view>
		</view>
		<action-sheet sheetTitle=" " alignment="center" :showSheetView="showSheetView" :displayCheckedIcon="true"
			:optionsList="deseaseList" titleKey="name" iconKey="cover" @onSelected="ed"></action-sheet>
	</view>
</template>

<script>
	import actionSheet from '@/components/zxp-uniActionSheet/zxp-uniActionSheet.vue'
	export default {
		components: {
			actionSheet
		},
		data() {
			return {
				deseaseList: [
					{name:'到课'},
					{name:'未到'},
					{name:'迟到'},
					{name:'请假'}
				],
				showSheetView: false,
				userList: [{
						name: '小明',
						status: 1,
						avatar: '',
						text: '到课',
						note: '扣1课时'
					},
					{
						name: '小明',
						status: 2,
						avatar: '',
						text: '请假',
						note: '扣1课时'
					},
					{
						name: '小明',
						status: 3,
						avatar: '',
						text: '未到',
						note: '扣1课时'
					},
					{
						name: '小明',
						status: 1,
						avatar: '',
						text: '到课',
						note: '扣1课时'
					}
				],
				rows: [{
						text: "课程名称",
						value: ""
					},
					{
						text: "上课教师",
						value: "上课教师"
					},
					{
						text: "上课教室",
						value: "上课教室"
					},
					{
						text: "点名时间",
						value: "点名时间"
					},
					{
						text: "上课内容",
						value: "上课内容"
					},
				],
			}
		},
		computed: {
			visibleRows() {
				return [] || this.isExpandedRate ? this.rows : this.rows.slice(0, 2); // 假设默认显示前5行
			}
		},
		methods: {
			toDetail() {
				uni.navigateTo({
					url: '/pages/course/assess/assess'
				})
			},
			onshowChange(e) {

			},
			toFilter(){
				this.showSheetView = true
			},
			ed(row) {
				/*这里必须将值置为false，否则无法唤起下一次的弹框显示*/
				this.showSheetView = false
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #f7f8fa;
	}

	.head {
		// height: 266rpx;
		opacity: 1;
		padding: 20rpx 50rpx;
		box-sizing: border-box;
		background: #FFFFFF;

		.info {
			display: flex;
			align-items: flex-start;
			flex-direction: column;

			.text1 {
				font-family: 苹方-简;
				font-size: 28rpx;
				font-weight: 500;
				line-height: 38rpx;
				text-align: center;
				letter-spacing: 0px;

				color: #3D3D3D;
			}

			.wrap {
				margin-top: 30rpx;
				display: flex;
				align-items: center;

				.text2 {
					ont-family: OPPOSans;
					font-size: 52rpx;
					font-weight: 500;
					line-height: 38rpx;
					text-align: center;
					letter-spacing: 0px;

					font-variation-settings: "opsz" auto;
					font-feature-settings: "kern" on;
					color: #3D3D3D;
				}

				.note {
					margin-left: 32rpx;
					width: 100rpx;
					height: 46rpx;
					text-align: center;
					line-height: 46rpx;
					font-size: 28rpx;
					border-radius: 8rpx;
					opacity: 1;
					color: #FFFFFF;
					/* 点缀色 */
					background: #FF8535;
				}
			}

		}

		.row {
			display: flex;
			margin: 30rpx 0;

			.text {
				margin-right: 60rpx;
				font-family: 苹方-简;
				font-size: 28rpx;
				font-weight: 500;
				line-height: 38rpx;
				text-align: center;
				letter-spacing: 0px;

				color: #3D3D3D;
			}

			.value {
				opacity: 0.7;
				font-family: 苹方-简;
				font-size: 28rpx;
				font-weight: 500;
				line-height: 38rpx;
				text-align: center;
				letter-spacing: 0px;

				color: #3D3D3D;
			}
		}
	}

	.tab {
		display: flex;
		align-items: center;
		justify-content: space-between;
		height: 114rpx;
		margin-top: 20rpx;
		margin-bottom: 20rpx;

		&-item {
			display: flex;
			width: 366rpx;
			height: 100%;
			padding: 16rpx 46rpx;
			border-radius: 8px;
			box-sizing: border-box;
			opacity: 1;
			background: #FFFFFF;

			.image {
				width: 82rpx;
				height: 82rpx;
				border-radius: 50%;
			}

			.info {
				display: flex;
				justify-content: space-around;
				flex-direction: column;
				align-items: flex-start;
				height: 82rpx;
				margin-left: 24rpx;

				.name {
					font-family: 苹方-简;
					font-size: 28rpx;
					font-weight: 500;
					line-height: 38rpx;
					text-align: center;
					letter-spacing: 0px;

					color: #3D3D3D;
				}

				.note {
					opacity: 0.5;

					font-family: 苹方-简;
					font-size: 24rpx;
					font-weight: 500;
					line-height: 38rpx;
					text-align: center;
					letter-spacing: 0px;

					color: #3D3D3D;
				}
			}
		}
	}

	.filter-wrap {
		display: flex;
		align-items: center;
		justify-content: space-between;
		height: 100rpx;
		background: #FFFFFF;
		padding: 0 40rpx;

		box-sizing: border-box;
		/* 描边 */
		border-width: 0px 0px 1px 0px;
		border-style: solid;
		border-color: rgba(230, 229, 231, 0.8);

		.left {
			display: flex;
			align-items: center;

			.item {
				display: flex;
				flex-direction: row;
				width: 80rpx;
				margin-right: 20rpx;

				.text {
					font-family: PingFang SC;
					font-size: 28rpx;
					font-weight: 500;
					line-height: 38rpx;
					text-align: center;
					letter-spacing: 0px;

					font-variation-settings: "opsz" auto;
					/* 迟到 */
					color: #3D3D3D;

					/* 0 */
				}

				.value {
					margin-left: 1rpx;
					color: #FF8535;
				}
			}
		}

		.right {
			display: flex;
			align-items: center;
			image{
				width: 30rpx;
				height: 30rpx;
			}

			.text {
				margin-left: 12rpx;
				font-family: PingFang SC;
				font-size: 28rpx;
				font-weight: 500;
				line-height: 38rpx;
				text-align: center;
				letter-spacing: 0px;

				font-variation-settings: "opsz" auto;
				color: #3D3D3D;

				z-index: 1;
			}
		}
	}

	.list {
		&-item {
			position: relative;
			display: flex;
			align-items: center;
			height: 160rpx;
			opacity: 1;
			background: #FFFFFF;
			padding: 12rpx 40rpx 12rpx 48rpx;
			box-sizing: border-box;
			border-width: 0px 0px 1px 0px;
			border-style: solid;
			border-color: rgba(230, 229, 231, 0.8);

			.avatar {
				width: 112rpx;
				height: 112rpx;
				opacity: 1;
				border-radius: 50%;
				background-color: orangered;
			}

			.info {
				display: flex;
				align-items: flex-start;
				flex-direction: column;
				justify-content: space-between;
				width: 96rpx;
				height: 85rpx;
				text-align: left;
				margin-left: 30rpx;

				.name {
					opacity: 1;
					font-family: 苹方-简;
					font-size: 32rpx;
					font-weight: 500;
					line-height: 38rpx;
					text-align: center;
					letter-spacing: 0px;

					color: #3D3D3D;
				}

				.note {
					opacity: 0.7;
					font-family: PingFang SC;
					font-size: 24rpx;
					font-weight: normal;
					line-height: 38rpx;
					letter-spacing: 0px;

					font-variation-settings: "opsz" auto;
					color: #3D3D3D;
				}
			}

			.fixed-right-text {
				position: absolute;
				top: 50%;
				/* 将图标定位到父元素顶部的中间位置 */
				transform: translateY(-50%);
				/* 使用transform属性将图标向上移动自身高度一半的距禿，实现居中效果 */
				right: 40rpx;

				/* 将图标定位到父元素的最右侧 */
				// width: 30px;
				// height: 30px;
				// border: 1px solid red;
				.status-text {
					font-family: 苹方-简;
					font-size: 28rpx;
					font-weight: 500;
					line-height: 38rpx;
					text-align: right;
					letter-spacing: 0px;
				}

			}
		}
	}
</style>